#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int N;
	cin >> N;
	int j = 0;
	int i = 0;
	for (i = 2; i <= sqrt(N); i++) {
		if (N % i == 0) {
			j = N / i;
			break;
		}
	}
	cout << max(i, j) << endl;
	return 0;
}